/**
 * @file register.cpp
 *
 * Copyright (C) 2024. Huawei Technologies Co., Ltd. All rights reserved.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 */
#include <torch/extension.h>
#include <torch/library.h>

#include "function.h"

// 在 myops 命名空间中注册两个操作模式：my_op 和 my_op_backward
TORCH_LIBRARY(myops, m)
{
    m.def("my_op(Tensor self, Tensor other_y, Tensor other_zero) -> Tensor");
    m.def("my_op_backward(Tensor self) -> (Tensor, Tensor)");
}

// 通过 pybind 将 C++ 接口绑定到 Python 接口
PYBIND11_MODULE(TORCH_EXTENSION_NAME, m)
{
    m.def("mmad_custom", &my_op_impl_autograd, "x * y");
}
